package com.isunland.managesystem.adapter;

import android.content.Context;
import android.text.TextUtils;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseListAdapter;
import com.isunland.managesystem.entity.ProjectCollectOriginal.ProjectCollectContent;
import java.util.List;

public class ProjectCollectListAdapter extends BaseListAdapter<ProjectCollectContent> {

  public ProjectCollectListAdapter(Context context, List<ProjectCollectContent> objects) {
    super(context, objects);
    // Auto-generated constructor stub
  }

  @Override
  public void bindData(int position, BaseListAdapter.ViewHolder vh, ProjectCollectContent item) {

    vh.mTitleOneTv.setText(R.string.projectName_colon);
    vh.mContentOneTv.setText(item.getProjectName());

    vh.mTitleTwoTv.setText(R.string.stages);
    vh.mContentTwoTv.setText(item.getStages());

    vh.mTitleThreeTv.setText(R.string.projectLeaveDays);
    if ("T".equals(item.getIfAcceptance())) {
      vh.mContentThreeTv.setText("已验收");
    } else {
      if (!TextUtils.isEmpty(item.getProjectLeaveDays())) {
        if (Integer.parseInt(item.getProjectLeaveDays()) < 0) {
          vh.mContentThreeTv.setText("已到期");
        } else {
          vh.mContentThreeTv.setText(item.getProjectLeaveDays());
        }
      }
    }

    vh.mContentThreeTv.setTextColor(getContext().getResources().getColor(R.color.red));
    vh.mTitleFourTv.setText(R.string.pmName);
    vh.mContentFourTv.setText(item.getPmName());
  }
}
